//
//  CYReceiveRewardListTVC.m
//  CreditAddressBookEE
//
//  Created by LE on 16/2/17.
//  Copyright © 2016年 Lee. All rights reserved.
//

#import "CYReceiveRewardListTVC.h"
#import "CYSimpleRewardM.h"
#import "CYCreditTool.h"

@interface CYReceiveRewardListTVC ()

@end

@implementation CYReceiveRewardListTVC

- (void)setList:(NSArray *)list {
    _list = list;
    [self.tableView reloadData];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}

#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.list.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    CYSimpleRewardM *model = self.list[indexPath.row];
    NSString *time = [CYCreditTool timewithLongLongValue:model.createtime.longLongValue formatter:@"yyyy年MM月dd日"];
    cell.textLabel.text = [NSString stringWithFormat:@"        %@**于%@领取了由%@**公司发布的%@悬赏金。", [model.linkName substringFromIndex:0 toIndex:1], time, [model.companyName substringFromIndex:0 toIndex:2], model.rewardMoney];
    cell.backgroundColor = [UIColor clearColor];
    cell.contentView.backgroundColor = [UIColor clearColor];
    cell.textLabel.font = [UIFont systemFontOfSize:14];
    cell.textLabel.textColor = [UIColor grayColor];
    cell.textLabel.numberOfLines = 0;
    return cell;
}
@end
